package com.heima.feigns;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.feigns.config.MyFeignAutoConfiguration;
import com.heima.feigns.fallback.ArticleFeignFallback;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Component
@FeignClient(value = "leadnews-article",
        configuration = MyFeignAutoConfiguration.class,
        fallbackFactory = ArticleFeignFallback.class)
public interface ArticleFeign {
    @GetMapping("/api/v1/author/findByUserId/{id}")
    ResponseResult<ApAuthor> findByUserId(@PathVariable("id") Integer userId);


    @PostMapping("/api/v1/author/save")
    ResponseResult<ApAuthor> saveUser(@RequestBody ApAuthor apAuthor);

    @GetMapping("/api/v1/article/{id}")
    ResponseResult<ApArticle> findArticleById(@PathVariable("id") Long id);
}
